<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<style>

</style>
</head>
<body>

<script>
  function  Star(name,age){
    this.name = name
    this.age  = age
    //在实例对象中添加一个方法  实例对象的方法,只有是实例对象的方法
    this.sing =function(Ldh){
      console.log('this',this)
      console.log(this=== Ldh)
    }
  }
  ///静态方法是添加构造函数上的方法,  只能是构造函数可以调用
  Star.dance  = function(){
    console.log('静态方法')
  }
  //原型对象  Star.prototype 指的是构造函数的原型对象
  console.log(typeof  Star.prototype)
  console.log(Star.prototype)
  Star.prototype.user = '张三'
  Star.prototype.song = function(){
    console.log('song')
  }
  
  //Ldh 指的是实例对象
  const Ldh = new Star('刘德华',18)
  console.log(Ldh)
  Ldh.sing(Ldh)

</script>
</body>
</html>